package com.atguigu.hellomp;

import com.atguigu.hellomp.entity.User;
import com.atguigu.hellomp.mapper.UserMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class T3 {
    @Autowired
    UserMapper userMapper;

    @Test
    public void test1() {
        User user = new User();
        user.setName("Tomi");
        user.setAge(18);
        user.setEmail("<EMAIL>");
        userMapper.insert(user);
    }

    @Test
    public void test2() {
        userMapper.deleteById(6L);
    }

    @Test
    public void test3() {
        IPage<User> userIPage =new Page<>(2,2);
//        userIPage.setCurrent(2);
//        userIPage.setSize(2);
        IPage<User> pageResult = userMapper.selectPage(userIPage, null);
        List<User> records = pageResult.getRecords();
        System.out.println(records);
    }
}
